package com.heima.utils.thread;

import com.heima.model.wemedia.pojos.WmUser;

/**
 * 自媒体端的ThreadLocal工具类
 *
 *
 *
 * @author DiXiaoNie
 * @date 2022/12/21
 * @since 2022/12/21 15:59
 */

public class WmThreadLocalUtil {

    /**
     * wm用户当前线程
     */
    private static final ThreadLocal<WmUser> WM_USER_THREAD_LOCAL = new ThreadLocal<>();


    /**
     * 设置用户线程本地wm
     *
     * @param wmUser wm用户
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static void setWmUserThreadLocal(WmUser wmUser) {
        WM_USER_THREAD_LOCAL.set(wmUser);
    }

    /**
     * 得到用户线程本地wm
     *
     * @return {@link WmUser }
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static WmUser getWmUserThreadLocal() {
        return WM_USER_THREAD_LOCAL.get();
    }

    /**
     * 删除用户线程本地wm
     *
     * @author DiXiaoNie
     * @date 2022/12/21
     */
    public static void deleteWmUserThreadLocal() {
        WM_USER_THREAD_LOCAL.remove();

    }


}
